package com.zjsd.sqeybusiness.service.impl;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.zjsd.sqeybusiness.domain.Lyhfinfo;
import com.zjsd.sqeybusiness.mapper.LyhfinfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zjsd.sqeybusiness.mapper.ShareLyMapper;
import com.zjsd.sqeybusiness.domain.ShareLy;
import com.zjsd.sqeybusiness.service.IShareLyService;

/**
 * 【请填写功能名称】Service业务层处理
 *
 * @author Zheng
 * @date 2021-03-19
 */
@Service
public class ShareLyServiceImpl implements IShareLyService
{
    @Autowired
    private ShareLyMapper shareLyMapper;

    @Autowired
    private LyhfinfoMapper lyhfinfoMapper ;

    /**
     * 查询【请填写功能名称】
     *
     * @param lyid 【请填写功能名称】ID
     * @return 【请填写功能名称】
     */
    @Override
    public ShareLy selectShareLyById(Long lyid)
    {
        return shareLyMapper.selectShareLyById(lyid);
    }

    /**
     * 查询【请填写功能名称】列表
     *
     * @param shareLy 【请填写功能名称】
     * @return 【请填写功能名称】
     */
    @Override
    public List<ShareLy> selectShareLyList(ShareLy shareLy)
    {
        List<ShareLy> list = new ArrayList<ShareLy>();
        List<ShareLy> shareLylist = shareLyMapper.selectShareLyList(shareLy);
        for(ShareLy temp :shareLylist){
            Lyhfinfo lyhfinfo = new Lyhfinfo();
            lyhfinfo.setLyid(temp.getLyid());
            List<Lyhfinfo> lyhfinfoList = lyhfinfoMapper.selectLyhfinfoList(lyhfinfo);
            temp.setLyhflist(lyhfinfoList);
            list.add(temp);
        }
        return list;
    }

    /**
     * 新增【请填写功能名称】
     *
     * @param shareLy 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int insertShareLy(ShareLy shareLy)
    {
        shareLy.setLysj(new Date());
        return shareLyMapper.insertShareLy(shareLy);
    }

    /**
     * 修改【请填写功能名称】
     *
     * @param shareLy 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int updateShareLy(ShareLy shareLy)
    {
        return shareLyMapper.updateShareLy(shareLy);
    }

    /**
     * 批量删除【请填写功能名称】
     *
     * @param lyids 需要删除的【请填写功能名称】ID
     * @return 结果
     */
    @Override
    public int deleteShareLyByIds(Long[] lyids)
    {
        return shareLyMapper.deleteShareLyByIds(lyids);
    }

    /**
     * 删除【请填写功能名称】信息
     *
     * @param lyid 【请填写功能名称】ID
     * @return 结果
     */
    @Override
    public int deleteShareLyById(Long lyid)
    {
        return shareLyMapper.deleteShareLyById(lyid);
    }
}
